<template>
  <img alt="Vue logo" src="./assets/logo.png" />
  <HelloWorld msg="Welcome to Your Vue.js App" />
</template>

<script>
import HelloWorld from "./components/HelloWorld.vue";
import Map from "ol/Map";
import View from "ol/View";
import TileLayer from "ol/layer/Tile";
import * as control from "ol/control";
import { Logo, TileSuperMapRest } from "@supermap/iclient-ol";

export default {
  name: "App",
  components: {
    HelloWorld,
  },
  setup() {
    var url =
      "https://iserver.supermap.io/iserver/services/map-world/rest/maps/World";
    var map = new Map({
      target: "map",
      controls: control
        .defaults({ attributionOptions: { collapsed: false } })
        .extend([new Logo()]),
      view: new View({
        center: [0, 0],
        zoom: 2,
        projection: "EPSG:4326",
      }),
    });
    var layer = new TileLayer({
      source: new TileSuperMapRest({
        url: url,
        wrapX: true,
      }),
      projection: "EPSG:4326",
    });
    map.addLayer(layer);
  },
};
</script>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
